package com.zhkj.txg.module.product.popup

import android.content.Context
import android.view.View
import com.zhkj.txg.R
import razerdp.basepopup.BasePopupWindow

class ProductDetailPopupWindow(
    context: Context,
    private val onClick: (type: Int) -> Unit
) : BasePopupWindow(context) {

    override fun onCreateContentView(): View = createPopupById(R.layout.popup_product_detail)

    override fun onViewCreated(contentView: View?) {
        // 跳转首页
        findViewById<View>(R.id.viewHome)?.setOnClickListener {
            onClick(0)
            dismiss()
        }
        // 跳转足迹
        findViewById<View>(R.id.viewVisit)?.setOnClickListener {
            onClick(1)
            dismiss()
        }
        // 跳转消息
        findViewById<View>(R.id.viewMessage)?.setOnClickListener {
            onClick(2)
            dismiss()
        }
        // 跳转分享
        findViewById<View>(R.id.viewShare)?.setOnClickListener {
            onClick(3)
            dismiss()
        }
    }
}